-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Git shallow clone for better performance #2403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we can't make a change like this that changes the default existing behavior for everyone in a minor.
Maybe if you make it opt in with a configuration flag |
68f2926
to
d0c8281
Compare
I added a configuration flag where the default is the existing behavior. |
@@ -773,6 +777,9 @@ public Git getGitByOpen(File file) throws IOException { | |||
|
|||
public CloneCommand getCloneCommandByCloneRepository() { | |||
CloneCommand command = Git.cloneRepository().setCloneSubmodules(cloneSubmodules); | |||
if (cloneShallow) { | |||
command.setDepth(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not allowing to specify a depth instead?
} | ||
|
||
public JGitFactory(boolean cloneSubmodules) { | ||
public JGitFactory(boolean cloneShallow, boolean cloneSubmodules) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will break compatibility with anybody calling the one parameter constructor. Also, I would put cloneShallow first. It should be the second parameter.
By default, the server clones the entire commit history from a remote repository. Downloading a huge commit history might be slow, so add a configuration property to truncate the commit history to a few commits. Fixes spring-cloud#1544
d0c8281
to
a5786c0
Compare
Do not download the entire commit history from the remote. Execute the equivalent of
git clone --depth 1
Fixes #1544